<?php
/**
 * +--------------------------------------------------------+
 * @Created by PhpStorm.
 * @Category LogAdminOperationCommand.php
 * @Depiction:
 * Author: hwy
 * Date: 2020/10/26  18:57
 * +--------------------------------------------------------+
 */

namespace App\Console\Commands;


use App\Models\LogAdminOperation;
use App\Services\SystemService;
use Illuminate\Console\Command;

class LogAdminOperationCommand extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'command:log_admin_operation';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = '操作日志记录';

    /**
     * Create a new command instance.
     *
     * @return void
     */
    public function __construct()
    {
        parent::__construct();
    }

    /**
     * Execute the console command.
     *
     * @return mixed
     */
    public function handle()
    {
        $this->info("开始..." . date('Y-m-d H:i:s'));

        $cache_name_log = 'log_operation';
        $res = SystemService::getInstance()->redisInsert($cache_name_log, LogAdminOperation::query());
        $this->info("写入数量..." . $res);
        $this->info("结束..." . date('Y-m-d H:i:s'));
    }

}
